* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --bg-secondary: white;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0,0,0,0.1);
    --star-color: #f39c12; /* Default star color for light theme */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    padding: 20px;
    transition: background 0.3s ease;
}

body.dark-theme {
    --bg-primary: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    --bg-secondary: #333;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --border-color: #555;
    --shadow-color: rgba(0,0,0,0.3);
    --star-color: #f1c40f; /* Star color for dark theme */
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.table-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.edition-text {
    font-size: 1.2em;
    color: #8B4513;
    font-weight: bold;
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    margin-left: auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5em;
    color: var(--text-primary);
    margin-bottom: 10px;
}

header p {
    color: var(--text-secondary);
    font-size: 1.2em;
}

.form-section {
    background: var(--bg-secondary);
    padding: 40px;
    box-shadow: 0 10px 30px var(--shadow-color);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    font-size: 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.3s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3498db;
}

.generate-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s;
}

.generate-btn:hover {
    transform: translateY(-2px);
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none;
}

.table-result {
    background: var(--bg-secondary);
    padding: 40px;
    box-shadow: 0 10px 30px var(--shadow-color);
}

.table-display {
    margin: 30px 0;
    text-align: center;
}

.table-3d {
    width: 300px;
    height: 200px;
    margin: 0 auto;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-20deg) rotateY(25deg);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: rotateX(-20deg) rotateY(25deg) translateY(0); }
    50% { transform: rotateX(-20deg) rotateY(25deg) translateY(-10px); }
}

.table-top {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #8B4513;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.table-leg {
    position: absolute;
    width: 20px;
    height: 100px;
    background: #654321;
    bottom: -100px;
}

.table-leg:nth-child(2) { left: 20px; }
.table-leg:nth-child(3) { right: 20px; }
.table-leg:nth-child(4) { left: 20px; bottom: -100px; }
.table-leg:nth-child(5) { right: 20px; bottom: -100px; }

.table-details {
    background: var(--bg-secondary);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.table-details h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.regenerate-btn {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.regenerate-btn:hover {
    background: #7f8c8d;
}

/* Reviews Section */
.reviews-section {
    margin-top: 30px;
    padding: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.reviews-section h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
}

.reviews-list {
    display: grid;
    gap: 15px;
}

.review-item {
    padding: 15px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.review-rating {
    color: var(--star-color); /* Use the CSS variable for star color */
    font-size: 1.2em;
}

.review-author {
    font-weight: bold;
    color: var(--text-primary);
}

.review-text {
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Color scheme variations */
.table-3d.ocean .table-top { background: #3498db; }
.table-3d.ocean .table-leg { background: #2980b9; }

.table-3d.forest .table-top { background: #27ae60; }
.table-3d.forest .table-leg { background: #229954; }

.table-3d.sunset .table-top { background: #e67e22; }
.table-3d.sunset .table-leg { background: #d35400; }

.table-3d.dark .table-top { background: #34495e; }
.table-3d.dark .table-leg { background: #2c3e50; }

.table-3d.light .table-top { background: #ecf0f1; border: 2px solid #bdc3c7; }
.table-3d.light .table-leg { background: #95a5a6; }

.table-image-container {
    margin: 30px 0;
    text-align: center;
}

.table-image {
    max-width: 100%;
    max-height: 400px;
    box-shadow: 0 10px 30px var(--shadow-color);
    transition: transform 0.3s ease;
}

.table-image:hover {
    transform: scale(1.05);
}

.achievement-popup {
    position: fixed;
    top: 20px;
    right: -300px;
    background: white;
    border: 2px solid #8B4513;
    border-radius: 0;
    padding: 15px 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: right 0.3s ease;
    z-index: 1000;
    max-width: 250px;
}

.achievement-popup.show {
    right: 20px;
}

.achievement-content h3 {
    margin: 0 0 5px 0;
    color: #8B4513;
    font-size: 1.2em;
}

.achievement-content p {
    margin: 0;
    color: #333;
    font-size: 0.9em;
}

.achievement-content h3::before {
    content: "🏆 ";
    margin-right: 5px;
}

body.dark-theme .achievement-popup {
    background: #1a1a1a;
    border-color: #8B4513;
}

body.dark-theme .achievement-content h3 {
    color: #8B4513;
}

body.dark-theme .achievement-content p {
    color: #ffffff;
}

body.dark-theme .achievement-content h3::before {
    color: #8B4513;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .table-3d {
        width: 250px;
        height: 150px;
    }

    .achievement-popup {
        right: -100%;
        left: 20px;
    }
    
    .achievement-popup.show {
        right: auto;
        left: 20px;
    }
}